<%--
	fileName      : branchlist_user.jsp
	author        : KFZX-yuli1
	createDate    : 2010-6-7  上午10:42:31
	lastModifier  : KFZX-yuli1
	lastModifyDate: 2010-6-7  上午10:42:31
	description   : 用户新增和修改
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>'<ctp:label key="branch.list.title.label"/>'</title>
		<ctp:include items='borderlayout,panel,toolbar,textfield,button,tabletree,combobox,form,textarea,label,lightlayout,gridlayout,groupbox,message_ex,validator'/>
		<%@ include file="/branch/branchlist.jsp" %>
		<script type="text/javascript" src="<ctp:out name='fullPath'/>user/authExt.js"></script>
		

		<script type='text/javascript' kind='variant'>	
		 //================================UI变量定义片段============================================================
            var borderlayout;//页面框架布局器
			var toolbar;//工具栏		
			var branchTreePanel;//
			var branchTree;//树表
			var branchlistform;//


	    </script>
        <script type='text/javascript' kind='event'>
        //ctp.core.log.lvl = ctp.core.loglvl.obj;
        	//================================函数定义片段============================================================
			
			var temp;
			 /**
             * 鼠标绑定记录
             * @version	 1.0
             * @since	 1.0
             * @author	KFZX-yuli1           
             */
			function setDetailValue(){			
			    	var _fnContext = "branchlist_user.jsp" + "->setDetailValue()";
				    try {
				    	var temp=branchTree.getSelectedObj()[0].ctp_ui_tableTree.data;//选择行的数据
				    	var authFlag = isAuth(temp.branchLevel);
				    	if(authFlag){
				    		toolbar.setDisable("botton1",false,"left");
			    			branchlistform.setHiddenValue("branchId",temp.id);//机构编号
			    			branchlistform.setHiddenValue("branchLevel",temp.branchLevel);//机构层级
			    			branchlistform.setHiddenValue("branchParent",temp.parentName);//父机构
			    			branchlistform.setHiddenValue("branchName",temp.name);//机构名称
				    	}else{
				    		toolbar.setDisable("botton1",true,"left");
				    	}
				    } 
				    catch (e) {
				        ctp.core.log.err(_fnContext, e.message);
				    }	
			}
			
			 /**
             * 判断角色管理操作权限函数
             * @version	 1.0
             * @since	 1.0
             * @author	KFZX-yuli1           
             */
            function isAuth(selectedLevel){
				var _fnContext = "branchlist_role.jsp" + "->isAuth()";
			    try {
                    var pAll='<ctp:out name="sessCtx.user.privilegeAll" />';//是否可管理全部机构
                    var pSelf='<ctp:out name="sessCtx.user.privilegeSelf" />';//是否可管理本机构
                    var pOther='<ctp:out name="sessCtx.user.privilegeOther" />';//可管理下级机构层级
                    var rLv='<ctp:out name="sessCtx.user.branchLevel" />'; //柜员的登陆级别 
                    var ret=privilegeJudge(pAll,pSelf,pOther,rLv,selectedLevel);//判断柜员操作级别
                    if(ret=="1" || ret=="2"){//可以进行管理
            	        return true;
                    }
                    return false;
			    } 
			    catch (e) {
			        ctp.core.log.err(_fnContext, e.message);
			    }	
			}
		</script>
		
	    <script type='text/javascript' kind='notUi'>
      		//================================非UI组件定义片段==========================================================


        </script>
        
        <script type='text/javascript' kind='ui'>
		    //================================UI组件定义片段============================================================
		    //ctp.core.log.lvl = ctp.core.loglvl.obj; //需要进行调试时启用
		    /**
             * 创建UI组件
             * @version	 1.0
             * @since	 1.0
             * @author	kfzx-yuli1       
             */		 
			 function initUI(){			 
					
					toolbar=new ctp.ui.toolbar({
						id : 'toolbarId',			
						border : 'bottom',			
				 	    leftItems :[{
						id:"botton1",
				        type : 'button',
				        text : '<ctp:label key="confirm" />',
				        disabled : true,
				        icon : 'apply',
				        useable : true,
				        onClick : function(){				        
				       		branchlistform.submit();}
				        }]
					});
			
			
					branchTreePanel=new ctp.ui.panel({
				        id:'tableTreePanelId',
				  	    title: '<ctp:label key="title_branchlist"/>',
				  	    collapsible: true,
				     	width: 'auto',
				     	//visible: 'visible',
				     	bodyPadding:'0',
				     	toolbar:toolbar,
                        toolbarPos:'innertop',
				     	height: '100%'			   
				    });
				    branchTree=cteateBranchTree(branchTreePanel,setDetailValue);  
	
	
					branchlistform=new ctp.form({
						 id: 'branchlist',
						 width: '90%', //宽度
				   		 postType:'normal'
					});
					borderlayout=new ctp.ui.borderlayout({
                         type: "1C",                    
                         center__size: "auto",
                         center__items:[branchTreePanel],
                         renderTo:'body'
                    }); 					
				}

</script>


	</head>
	<body onload='initUI()'>	
		<ctp:form name="branchlist" method="post" action="user.flowc" flowActionName="userbranchop">
			<input type="hidden" name="branchId">
			<input type="hidden" name="branchName">
			<input type="hidden" name="branchLevel">
			<input type="hidden" name="branchParent">
		</ctp:form>
	</body>
</html>

<%--
	date        :
	modifyReason:
--%>